<%@ page import="com.surelution.projects.crm.OwnStation" %>
<%@ page import="com.surelution.projects.crm.CompetitorStation" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'competitorStation.label', default: 'CompetitorStation')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="stationImport"><g:message code="default.stationImport.label" args="[entityName]" /></g:link></span>
 		    <span class="menuButton"><g:link class="export" action="export">${message(code: 'default.button.export.label', default: 'Export')}</g:link></span>
 		    <span class="menuButton"><g:link class="export" action="comparePrice">${message(code: 'default.button.comparePrice.label', default: 'Export')}</g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            
            <sec:ifAnyGranted roles="ROLE_ADMIN">
             <g:form action="list" controller="competitorStation">
                <div class="dialog3">
                    <table>
                        <tbody>
                        	<tr class="prop">
                                <td valign="top" class="name">
                                    所属油站
                                </td>
                                <td valign="top" class="value">
                                	<g:select name="station.id" from="${OwnStation.list()}" optionKey="id" optionValue="shortName" noSelection='${["":""] }' value="${params['station.id'] }"/>
                                	<g:submitButton name="search" class="search" value="${message(code: 'default.button.search.label', default: 'Search')}" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </g:form>
           </sec:ifAnyGranted>
           
            <div class="list">
                <table>
                    <thead>
                        <tr>
                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="competitorStation.name.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="competitorStation.address.label"/></th>
                        
                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.station.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="competitorStation.company.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="competitorStation.managerTel.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="competitorStation.manager.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="market.isLocked.label"/></th>
                    </thead>
                    <tbody>
                    <g:each in="${competitorStationInstanceList}" status="i" var="competitorStationInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            <td><g:link action="show" id="${competitorStationInstance.id}">${fieldValue(bean: competitorStationInstance, field: "name")}</g:link></td>
                        
                            <td>${fieldValue(bean: competitorStationInstance, field: "address")}</td>
                        
                            <td>${fieldValue(bean: competitorStationInstance, field: "station.shortName")}</td>

                            <td>${fieldValue(bean: competitorStationInstance, field: "company.name")}</td>
                            
                            <td>${fieldValue(bean: competitorStationInstance, field: "managerTel")}</td>
                            
                            <td>${fieldValue(bean: competitorStationInstance, field: "manager")}</td>
                            
                            <td><g:formatBoolean boolean="${competitorStationInstance.isLocked}" /></td>

                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${competitorStationInstanceTotal}" params="${params}"/>
            </div>
        </div>
    </body>
</html>
